Field of the Invention
The present invention relates to data storage devices with flash memory and flash memory control methods.
Description of the Related Art
Flash memory, a data storage medium, is common in today's data storage devices. For example, flash memory is typically used in memory cards, USB flash devices, solid-state drives, and so on. In another application with multi-chip package technology, a NAND flash chip and a controller chip are combined in one package as an embedded multi-media card (e.g. eMMC).
A flash memory device provides storage space which is divided into blocks, and each block includes a plurality of pages. An erase operation designed for flash memory is performed on a block-by-block basis, to release space one block at a time. When updating data, the new data is written into a spare space rather than being overwritten on the old data. It is more complex to manage a flash memory rather than other conventional storage mediums, especially if an unexpected power-off event occurred. An unexpected power-off event may damage a run-time write block (for reception of write data) of a flash memory.
Furthermore, for the convenient management of the flash memory, the physical-to-logical address mapping information of each block is dynamically collected in a volatile memory (e.g., an SRAM). The physical-to-logical address mapping information dynamically collected in the volatile memory has to be uploaded to the flash memory for non-volatile storage. It can be very tricky to determine when and how the mapping information uploading is performed.